Tổng hợp trắc nghiệm & bài code từ cơ bản đến nâng cao
let arr = [1, 2, 3]; arr[5] = 10; console.log(arr.length);
let obj = {
x: 10,
getX: function() {
return this.x;
}
};
let getX = obj.getX;
console.log(getX());
console.log(0.1 + 0.2 === 0.3);
name vào chuỗi sử dụng template string?
Trung bình
name của object person?
Dễ
[1,2,3].indexOf(2)?
Dễ
str = "Hello World"?
Khó
// Ví dụ: toUpperCaseString("hello") => "HELLO"
// Ví dụ: sumArray([1,2,3]) => 6
// Ví dụ: getObjectKeys({a:1, b:2}) => ["a", "b"]
// Ví dụ: isPalindrome("madam") => true
// isPalindrome("hello") => false
[
{ name: "An", score: 9 },
{ name: "Bình", score: 7 },
{ name: "Cường", score: 8.5 }
]
// Output:
{
total: 3,
average: 8.17,
goodStudents: ["An", "Cường"]
}
// Ví dụ: getVietnameseDay("2025-07-05") => "Thứ bảy"